﻿Imports System.Reflection

''' <summary>
''' プロパティアーカイブ
''' </summary>
''' <remarks></remarks>
Public MustInherit Class PropertyArchive

    Private _owner As ItemEntityArchive
    ''' <summary>
    ''' オーナーアイテムエンティティアーカイブ
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Owner() As ItemEntityArchive
        Get
            Return _owner
        End Get
        Friend Set(ByVal value As ItemEntityArchive)
            _owner = value
        End Set
    End Property

    Private _property As PropertyInfo
    ''' <summary>
    ''' プロパティ情報
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property PropertyInfo() As PropertyInfo
        Get
            Return _property
        End Get
        Friend Set(ByVal value As PropertyInfo)
            _property = value
           End Set
    End Property

    ''' <summary>
    ''' ユニーク文字列
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overridable ReadOnly Property Key As String
        Get
            If Me.PropertyInfo Is Nothing Then Throw New InvalidOperationException()
            Return Me.PropertyInfo.Name
        End Get
    End Property

    ''' <summary>
    ''' システム値属性を持っているかどうかを示します
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public MustOverride ReadOnly Property HasSystemValue() As Boolean

    ''' <summary>
    ''' システム値属性
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public MustOverride ReadOnly Property SystemValueAttribute As SpecialValueAttribute

    ''' <summary>
    ''' ダーティかどうかを示します
    ''' </summary>
    ''' <param name="instance">検査対象</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public MustOverride Function IsDirty(instance As Object) As Boolean

    ''' <summary>
    ''' アーカイブします
    ''' </summary>
    ''' <param name="instance"></param>
    ''' <remarks></remarks>
    Public MustOverride Sub Regist(instance As Object)

End Class
